package com.ingenius.sau.client;

import com.extjs.gxt.ui.client.GXT;
import com.extjs.gxt.ui.client.util.Theme;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.user.client.ui.RootPanel;
import com.ingenius.sau.client.service.CoreService;
import com.ingenius.sau.client.service.CoreServiceAsync;
import com.ingenius.sau.client.service.GuidelinesService;
import com.ingenius.sau.client.service.GuidelinesServiceAsync;
import com.ingenius.sau.client.service.InstrumentsService;
import com.ingenius.sau.client.service.InstrumentsServiceAsync;
import com.ingenius.sau.client.service.UsersService;
import com.ingenius.sau.client.service.UsersServiceAsync;

/**
 * Entry point classes define <code>onModuleLoad()</code>.
 */
public class Main implements EntryPoint {

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.google.gwt.core.client.EntryPoint#onModuleLoad()
	 */
	@Override
	public void onModuleLoad() {

		GXT.setDefaultTheme(Theme.BLUE, true);

		HandlerManager eventBus = new HandlerManager(null);
		CoreServiceAsync rpcCoreService = GWT.create(CoreService.class);
		GuidelinesServiceAsync rpcGuidelinesService = GWT
				.create(GuidelinesService.class);
		InstrumentsServiceAsync rpcInstrumentsService = GWT
				.create(InstrumentsService.class);
		UsersServiceAsync rpcUsersService = GWT.create(UsersService.class);

		AppController appViewer = new AppController(eventBus, rpcCoreService,
				rpcGuidelinesService, rpcInstrumentsService, rpcUsersService);
		appViewer.go(RootPanel.get("content"));

		RootPanel.get("loading").setVisible(false);
	}

}
